import React, { Component } from 'react'
import { Clipboard, Text, View } from 'react-native'
import {Toast} from 'native-base'
import Dialog, {
	DialogTitle,
	DialogContent,
	DialogFooter,
	DialogButton,
	ScaleAnimation
} from 'react-native-popup-dialog'

export default class BindDialog extends Component {
	constructor(props) {
		super(props)
		this.state = {
			hasTitleBar: false
		}
	}
	copy(text) {
		Clipboard.setString(text)
		Toast.show({
            text: "复制成功",
			textStyle: { textAlign: "center" },
            type: "success"
        })
	}
	render() {
		return (
			<View>
				<Dialog
					visible={this.props.visible}
					onTouchOutside={() => {
						this.props.setVisible(false)
					}}
					width={0.9}
					dialogAnimation={new ScaleAnimation()}
					dialogTitle={
						<DialogTitle
							hasTitleBar={this.state.hasTitleBar}
							title="提示"
						/>
					}
					footer={
						<DialogFooter>
							<DialogButton
								text="复制公众号"
								bordered
								onPress={() => {
									this.copy(this.props.wxPublic)
									this.props.setVisible(false)
								}}
								key="button-2"
							/>
						</DialogFooter>
					}
				>
					<DialogContent>
						<Text style={{ lineHeight: 20 }}>
							请在微信搜索和关注公众号“{this.props.wxPublic}”，按照提示完成账号绑定，即可进行零钱提现。
						</Text>
					</DialogContent>
				</Dialog>
			</View>
		)
	}
}
